The present invention is directed to a system for assisting a date logic programmer in the generation of date logic, and also to such a system where the generated date logic can be subjected to a series of tests so that the date logic programmer can confirm that correct and appropriate date logic has been generated.
Traditionally, date logic code for a calendaring program is written by a programmer "by hand," and therefore must be thoroughly tested to insure that the date logic code functions as intended. In some cases, the programmer will have written similar or equivalent code, or will have access to similar or equivalent code, which can be copied to the appropriate location in the calendaring program. Even if the copied code is at first inspection equivalent to the code required, the input and output parameters must be altered so as to interface correctly given the new location of the code. Although this somewhat reduces the likelihood of programming errors, it by no means eliminates the chance that the date logic code will not function correctly, since the date logic may not be equivalent or as similar as thought, or may not interface as thought with the environment provided by the surrounding program. Therefore, the code must still be tested thoroughly to insure that it functions as intended.
To test the calendaring function the programmer must first compile the new code, then run the code, and then compare the output from the code with the output expected in view of data values supplied by the data files or internally generated by the program. This is time consuming and inconvenient for a number of reasons: the program must be recompiled after every alteration of the code; the values in the data files may produce output values from the calendaring function which will not be easy to verify as correct; or internally-generated data values may produce output values from the calendaring function which will not be easy to verify as correct. Alteration of the internally-generated data values is therefore generally extremely inconvenient.
The date logic generator of the present invention provides a calendaring utility which generates calendaring functions, and allows the programmer to test the calendaring functions in a straightforward manner without recompilation of the code. To use the date logic generator, a programmer enters a program in edit mode, locates a portion of the program where the computer code for a calendaring function is to be altered or new code is to be generated, and calls the date logic generator. The date logic generator provides an initial window with a choice of calendaring functions. Upon selecting a calendaring function, a parameters window for that function is provided. A number of first-level parameters titles are initially displayed in the parameters window, and if those parameters have default values, the default are also displayed. Depending on the specification by the programmer of the values of the first-level parameters, sub-windows with second-level parameters titles may be provided for specification, and if parameters have default values, then the default are also displayed. In general, depending on the specification by the programmer of the values of the n-level parameters, (n+1)-level parameters titles may be provided in sub-windows for specification. The displayed parameters titles provided at any time are only those whose values have been specified or whose values require specification, thereby making the utility simple to use.
When the programmer believes the calendaring function has been correctly specified, the operation of the function may be tested by the date logic generator of the present invention, without requiring recompilation of the computer code. To test the calendaring function the programmer invokes the testing utility, provides data for the calendaring function in a testing sub-window providing by the testing utility, and runs the testing utility. The programmer can then compare the output of the testing utility with an expected output and, if the output does not correspond to the output expected from the desired calendaring function, modify the values of the parameters of the calendaring function as appropriate. Further runs of the testing utility and modifications of the parameters of the calendaring function can be performed as needed.
By providing parameter windows where all but the required parameter titles are hidden, by allowing the testing of the calendaring functions with data provided by the programmer while in the utility, and by generating the computer code based on the specified parameters values, the date logic generator of the present invention is extremely advantageous. With the date logic generator of the present invention, calendaring code is generated more quickly, efficiently and accurately than previously possible.
The calendaring utility of the present invention includes a variety of calendaring functions, features and options which have been selected to provide a calendaring system which should perform most any required purpose. The many functions, features and options of the present invention are useful per se, and in combination provide a synergistic advantage by virtue of their completeness, so a programmer will not need to augment the calendaring functions provided.
The calendaring utility of the present invention allows the programmer to choose among at least ten different holiday tables. This can be useful if the programmer conducts business with outside areas of commerce, such as foreign commerce, or if various areas of the programmer's shop observe different holiday schedules.
The calendaring utility also allows the programmer to specify dates at least fifty-two different date formats. The utility also permits the programmer to define each day of the week as a processing day or a nonprocessing day. When processing and nonprocessing days are defined, holidays may be taken into consideration. The utility also allows the programmer to select any of the twelve months as the start of the fiscal year, and permits the programmer to specify day 01 through 28 as the start of the fiscal month. Additionally, the utility allows the programmer to specify whether the "from-date" and/or the "to-date" should be counted in calendaring calculations. The utility also provides implicit and explicit access to the current date.
The utility offers the programmer over three hundred functions. These functions fall into three basic groups: utility functions, calendar day functions, and processing day functions. Calendar day functions perform date calculations based on calendar days, and processing day functions perform date calculations based on processing days. Utility functions perform date calculations which are independent of calendar day and/or processing day considerations. Functions provided by the system allow for date calculations based on calendar or fiscal time units (i.e., years, months or quarters).
It should be noted that the year 2000 is rapidly approaching and there are a number of reasons why the upcoming century transition, from 1999 to 2000, poses problems to many currently existing calendaring systems. First, data processing systems that examine only the last two digits of the year may conclude, for instance, that the year 2000 is earlier than the year 1999, simply because 00 is less than 99. This is known as "inversion of years." Second, although the year 2000 is a leap year, data processing systems that have incomplete leap-year logic may not be aware that (although the years 1900 and 2100 are not leap years) the year 2000 is a leap year. Third, since the year 2000 ends in the digits `00`, data processing systems that divide by the two-digit representation of the year run the risk of terminating abnormally. The calendaring functions of the present invention address these, and other calendar-related problems. The utility of the present invention can handle any four digit year, i.e., any year from 0001 through 9999. The system uses a set of rules which distinguishes all leap years from nonleap years in this range.
Among the functions provided by the utility of the present invention are conversions between a 360-day-year calendar and the Gregorian and Julian calendars. Gregorian dates are based on the Gregorian calendar where, according to the old rhyme, "Thirty days hast September, April, June and November; All the rest have thirty-one; Except for February which has 28 days clear; And 29 in each leap year." A Julian date has a year and a day-of-the-year between 1 and 365. For example, since January has 31 days, the Gregorian date of Feb. 5, 1995 is written in Julian form as 036/1995. Method and apparatus for conversion between Julian and Gregorian calendars are well-known in the art, and any efficient system can be used in conjunction with the calendar conversions of the utility of the present invention.
The 360-day-year calendar was developed for financial calculations because of the simplicity of a year where each month has 30 days. For instance, the day-of-the-year which is 46% of a year past March 1 is easily determined by noting that 169.2 is 46% of 360, and since it is easily determined that 169 equals 5.times.30 plus 19, an increment of 169 days in a 360-day-year is an increment of five months and nineteen days. Therefore, August 20 is 46% of a year past March 1 according to a 360-day-year calculation. Another advantage of the use of a 360-day year calendar is that many fractional year increments are equal to an integer number of months: one twelfth of a year is one month, one sixth of a year is two months, one fourth of a year is three months, one third of a year is four months, and one half of a year is sixth months. Although this type of simplification is not of as much use in the current age of microelectronics, many financial institutions still use 360-day-year methods for ongoing calculations which were started using a 360-day-year method. Also, 360-day-year methods are implemented in business or legal situations where such methods remain a standard.
Typically, conversion of Gregorian or Julian dates to 360-day-year dates and conversion of 360-day-year dates to Julian or Gregorian dates is accomplished using algebraic methods. However, such algebraic methods generate dates which do not actually exist, or generates gaps between existing dates. In contrast, the utility of present invention converts Gregorian calendar dates to dates of a 360-day-year calendar, and 360-day-year calendar dates to Gregorian calendar dates, using a single three-column 367-entry conversion table. A search table unit searches the conversion table from the bottom upwards, i.e., a table search index is initialized to a value of 367, and decremented by unity each time a comparison is made and a match is not found, thereby insuring that all Gregorian and Julian dates generated do exist
An object of the present invention is therefore to provide a utility for assisting a date logic programmer in the generation of date logic.
Another object of the present invention is to provide a utility which reduces the likelihood of errors in the generation of date logic.
Another object of the present invention is to provide a utility for increasing the reliability of date logic code.
Another object of the present invention is to provide a straightforward and nontechnical utility for the generation of date logic.
Another object of the present invention it to provide a utility for the generation of date logic which displays only those parameter sub-windows which are relevant in view of the parameter values which have already been specified.
Another object of the present invention is provide a utility where date logic can be subjected to one or more real-time tests so that the programmer can confirm that correct and appropriate date logic has been generated.
Another object of the present invention is provide a utility with which a programmer can generate and test date logic source code without requiring the compilation of the code.
Another object of the present invention is provide a utility where a selected calendaring function or its parameters can be easily altered, particularly if tests indicate that an incorrect calendaring function or function parameters were previously specified.
Further objects and advantages of the present invention will become apparent from a consideration of the drawings and the ensuing detailed description.
The present invention is directed to a utility which generates computer code for a calendaring function at a selected location in a computer program. The utility includes a means for presenting a choice of calendaring functions on the computer display screen, a means for selecting the calendaring function from amongst the choice of calendaring functions, a means for presenting a choice of parameters associated with the calendaring function, a means for specifying values for the parameters, and a means for generating the computer code for the calendaring function with the specified parameter values at the selected location in the computer program.